<!DOCTYPE html>
<html class="base_gary_bg_color">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>师傅端评分页</title>
		<link rel="stylesheet" type="text/css" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/base.css">
		<style type="text/css">
			.title {
				font-size: 16px;
			}
			.score_div {
				padding: 2px 5px;
			}
			.feeling {
				border-bottom: 1px solid #ededed;
			}
			.title {
				border-left: unset;
				padding-left: 0px;
			}
			.score_div:before {
				background-color: #EDEDED;
				height: 1px;
			}
			.feeling {
				padding-bottom: 1px;
			}
			.score_group_div {
				margin: 18px 15%;
			}
			.pingfen_group_div {
				margin: 18px 15%;
			}
			.pingfen {
				line-height: 40px;
			}
			.pingfen  label ~
			input {
				float: left;
				width: 28%;
				height: 32px;
				line-height: 20px;
				padding: 4px 0px;
				text-align: center;
				margin-bottom: 0;
				padding-left: 0;
				border: 1px solid #d9d9d9;
			}
			.pingfen  label {
				/*line-height: 1.1;*/
				vertical-align: middle;
				font-size: 1rem;
				float: left;
				width: 40%;
				line-height: 9px;
				height: 32px;
				padding: 0.7rem 0;
				padding-left: 0.8rem;
				padding-right: 0.1rem
			}
			.pingfen span {
				vertical-align: middle;
				font-size: 1rem;
				line-height: 0;
				height: 32px;
				padding: 0.7rem 0;
				padding-left: 0.8rem;
				padding-right: 0.1rem
			}
			.score {
				/* text-align: center;
				 vertical-align: middle;*/
			}
			.score p {
				text-align: center;
			}
			.score p span {
				line-height: 1.1;
				font-size: 1rem;
				color: #333;
			}
			.sign_score {
				color: #18B4ED;
				min-width: 1em
			}
			.bottom_btn_div {
				color: #FFF;
				height: 45px;
				width: 100%;
				z-index: 995;
				border-top: 1px solid #d9d9d9;
				position: fixed;
				bottom: 0px;
				left: 0px;
				text-align: center;
				margin-top: 23px;
			}
			.bottom_btn_div a {
				line-height: 45px;
				font-size: 14px;
				background: #18b4ed;
				width: 100%;
				color: #FFF;
			}
			.title img {
				height: 20px;
				padding-top: 4px
			}
			.summary_title {
				display: inline-block;
				background: url(../../icon/icon_summary_title.png) no-repeat left center;
				background-size: 20px;
				padding-left: 25px
			}
			.comment_title {
				display: inline-block;
				background: url(../../icon/icon_comment_title.png) no-repeat left center;
				background-size: 18px;
				padding-left: 25px
			}
			.grade_title {
				display: inline-block;
				background: url(../../icon/icon_grade_title.png) no-repeat left center;
				background-size: 18px;
				padding-left: 25px
			}
			.noscore {
				text-align: center;
				vertical-align: middle;
			}
			.info-span {
				/*width: 40%;*/
			}
			.sign_score_span {
				text-align: right;
			}
			.padding15 {
				padding: 5px 10px;
			}
		</style>
	</head>
	<body class="base_gary_bg_color">
		<div class="base_style_color base_title_Immerse" id='BarAppearance' ></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar base_title_position" >
			<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span id="stu_name">张三</span>
			<a class="base_right_item nav-item" id="wancheng"> </a>
		</div>
		<div class="base_content_div writeReport">
			<div class="ReviewWeekly_div top_54">
				<div class="feeling">
					<p class="title ">
						岗位考核
					</p>
				</div>
				<div class="score_div" id="grade" style="display: none">
					<div class="pingfen_group_div">
						<div class="mui-input-row pingfen" style="margin-left: 0.3rem">
							<label>KPI考核:</label>
							<input type="tel"   onkeyup="onlyNum(this)" id="kpi_score">
							<span >分</span>
						</div>
						<div class="mui-input-row pingfen" style="margin-top: 10px;margin-left: 0.3rem">
							<label>能力态度:</label>
							<input type="tel"   onkeyup="onlyNum(this)" id="ability_score">
							<span >分</span>
						</div>
						<div class="mui-input-row pingfen" style="margin-top: 10px;margin-left: 0.3rem">
							<label>事件考核:</label>
							<input type="tel"   onkeyup="onlyNum(this)" id="event_score">
							<span >分</span>
						</div>
					</div>
				</div>
				<div class="score_div" id="score"  style="display: none">
					<div class="score_group_div">
						<div class="mui-input-row score" >
							<p>
								<span class="info-span" style="text-indent: 10px">kpi考核:</span>
								<span class="sign_score_span" ><em class="sign_score" id="score_kpi">-</em><span style="margin-left: 4px">分</span></span>
							</p>
						</div>
						<div class="mui-input-row score" >
							<p>
								<span class="info-span">能力态度:</span>
								<span class="sign_score_span"><em class="sign_score" id="score_ability">-</em><em style="margin-left: 4px">分</em></span>
							</p>
						</div>
						<div class="mui-input-row score" >
							<p>
								<span class="info-span">事件考核:</span>
								<span class="sign_score_span"><em class="sign_score" id="score_event">-</em><em style="margin-left: 4px">分</em></span>
							</p>
						</div>
					</div>
				</div>
			</div>
			<div class="ReviewWeekly_div">
				<div class="feeling">
					<p class="title ">
						实习态度
					</p>
				</div>
				<div class="score_div">
					<div class="score_group_div">
						<div class="mui-input-row score " >
							<p>
								<span class="info-span " >实习签到:</span>
								<span class="sign_score_span" ><em class="sign_score" id="sign_score">-</em><em style="margin-left: 4px">分</em></span>
							</p>
						</div>
						<div class="mui-input-row score" >
							<p>
								<span class="info-span">个人总结:</span>
								<span class="sign_score_span"><em class="sign_score" id="summary_score">-</em><em style="margin-left: 4px">分</em></span>
							</p>
						</div>
					</div>
				</div>
			</div>
			<div class="ReviewWeekly_div">
				<div class="feeling">
					<p class="title">
						知识考核
					</p>
				</div>
				<div class="score_div">
					<div class="score_group_div" id="Course_scores">
						<!--		<div class="mui-input-row score" >
						<p >
						<span class="info-span">考核名称1:</span>
						<span class="sign_score_span"><em class="sign_score">-</em><em style="margin-left: 4px">分</em></span>
						</p>
						</div>
						<div class="mui-input-row score" >
						<p>
						<span>考核名称2:</span>
						<span class="sign_score_span"><em class="sign_score">-</em><em style="margin-left: 4px">分</em></span>
						</p>
						</div>-->
					</div>
				</div>
			</div>
			<div class="ReviewWeekly_div" style="margin-bottom: 66px">
				<div class="score_div">
					<div class="score_group_div">
						<div class="mui-input-row score" >
							<p class="noscore">
								<span class="info-span" >综合总分:</span>
								<span class="sign_score_span"><em class="sign_score" id="sum_score">--</em><em style="margin-left: 4px">分</em></span>
							</p>
						</div>
					</div>
				</div>
			</div>
			<div class="bottom_btn_div" id="sub_div" onclick="SubmitToast()" style="display: none">
				<a id="submit_info">提交</a>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/mui.min.js"></script>
	<script src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/base64.min.js"></script>
	<script type="text/javascript" src="../../script/copyTool.js"></script>
	<script type="text/javascript">
		var kpi_score = "";
		var ability_score = "";
		var event_score = "";
		/*提交状态 1:重复提交，0是正常提交*/
		var submit_type = 0;
		apiready = function() {
			$('#stu_name').text(api.pageParam.rename1);
			listenScroll();
			loadMonthData();
			sendBuriedNotifi('0', '师傅端评分列表详情页', '245')
		};
		function backClick() {
			sendBuriedNotifi('1', '师傅端评分列表详情页', '245')
			api.closeWin({
			});
		}

		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjid'),
				uname : $api.getStorage('cfnetppusername'),
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		//加载数据
		function loadMonthData() {
			var param = {
				jid : $api.getStorage('cfnetppjid'),
				uid : $api.getStorage('cfnetppuid'),
				gwid : api.pageParam.gwid,
				id : api.pageParam.id
			};
			cfnetppPOST(url_getStudentInternshipinfo, param, false, function(data, status) {
				if (status == 'success') {
					if (data.code == 200) {
						var list = data.data;
						if (api.pageParam.scores_status == 1 && (list.status == 3 || list.status == 4)) {//已评通过,已评未通过
							$('#grade').hide();
							$('#sub_div').hide();
							$('#score').show();
							$('#sum_score').text(list.scores);
							preMasterscoresUI(list.masterscores);
							preTeacherscoresUI(list.teacherscores)
							preCourse_scoresUI(list.course_scores)
						} else if (api.pageParam.scores_status == 1 && list.status != 3 && list.status != 4) {//已评未审核
							$('#grade').hide();
							$('#score').show();
							$('#sub_div').hide();
//							$('#sum_score').text(list.scores);
							preMasterscoresUI(list.masterscores);
						} else if (api.pageParam.scores_status == 0 && list.master_status == 1) {//已评未通过变更成成未评进行中,师傅已经评价了,现在进行重新评分
							$('#grade').hide();
							$('#score').show();
							$('#sub_div').show();
							$('#submit_info').html('重新评分');
							$('#sum_score').text(data.scores);
							preMasterscoresUI(list.masterscores);
							preTeacherscoresUI(list.teacherscores)
							preCourse_scoresUI(list.course_scores)
							submit_type = 1;
						} else {//未评分
						    if(!api.pageParam.isagain){//正常评分
								$('#grade').show();
								$('#score').hide();
								$('#sub_div').show();
						   }else{//重新评分后的提交
						        $('#submit_info').html('提交');
						        $('#grade').show();
								$('#score').hide();
								$('#sub_div').show();
							    preTeacherscoresUI(list.teacherscores)
								preCourse_scoresUI(list.course_scores)
						   
						   }

						}
					} else {
						ShowToast(data.message);
					}
				} else {
					api.toast({
						msg : '网络连接失败',
						duration : 2000,
						location : 'bottom'
					});
				}
			});
		}

		//企业评分ui布局
		function preMasterscoresUI(data) {
			if (!isObjectEmpty(data)) {
				$('#score_kpi').text(parseInt(data.kpi_scores));
				$('#score_ability').text(parseInt(data.ability));
				$('#score_event').text(parseInt(data.event));
			} else {
				$('#score_kpi').text('--');
				$('#score_ability').text('--');
				$('#score_event').text('--');
			}
		}

		//老师评分ui布局
		function preTeacherscoresUI(data) {
			if (!isObjectEmpty(data)) {
				$('#sign_score').text(parseInt(data.internship));
				$('#summary_score').text(parseInt(data.conclusion));
			} else {
				$('#sign_score').text('--');
				$('#summary_score').text('--');
			}
		}

		//课程评分ui布局
		function preCourse_scoresUI(data) {
			var htmlsdata = "";
			var listdata = data.scoreslist;
			if (!isObjectEmpty(data) && data.hasOwnProperty("scoreslist")) {
				for (var i = 0; i < listdata.length; i++) {
					var data = listdata[i];
					var htmls = '<div class="mui-input-row score" >' + '<p>' + '<span>' + data.testname + ':</span>' + '<span class="sign_score_span"><em class="sign_score">' + scoreisNull(data.testscore) + '</em><em style="margin-left: 4px">分</em></span>' + '</p>' + '</div>';
					htmlsdata = htmlsdata + htmls;
				}
				$('#Course_scores').html(htmlsdata);
			} else {
				var str = '<p class="noscore">暂无</p>'
				$('#Course_scores').html('<p class="noscore">暂无</p>');
			}
		}

		//判断分数是否为空
		function scoreisNull(score) {
			var str = "";
			if (isEmpty(score)) {
				return '--';
			} else {
				return score;
			}
		}

		// 滚动监听
		function listenScroll() {
			var winHeight = $(window).height();
			//获取当前页面高度
			$(window).resize(function() {
				var thisHeight = $(this).height();
				if (winHeight - thisHeight > 50) {
					//当软键盘弹出，在这里面操作
					$("#sub_div").css('display', 'none');
				} else {
					$("#sub_div").css('display', 'block');
					//当软键盘收起，在此处操作
				}
			});
		}

		//提交判断
		function SubmitToast() {
			if (submit_type == 1) {//重新打分
				againGrade()
			} else {
				SubmitData()
			}
		}

		//提交数据
		function SubmitData() {
	
			kpi_score = $('#kpi_score').val();
			ability_score = $('#ability_score').val();
			event_score = $('#event_score').val();
		
				
			if (kpi_score > 100 || ability_score > 100 || event_score > 100) {
				ShowToast('请输入准确的分数');
			} else if (isEmpty(kpi_score) || isEmpty(ability_score) || isEmpty(event_score)) {
				ShowToast('请打分');
			} else {
				showProgress();
			    var params = {
					jid : $api.getStorage('cfnetppjid'),
					uid : $api.getStorage('cfnetppuid'),
					gwid : api.pageParam.gwid,
					//				id : api.pageParam.id
					sxfpid : api.pageParam.id,
					kpi_scores : kpi_score,
					ability : ability_score,
					event : event_score,
					sfid : $api.getStorage('cfnetppuid')
				};
				cfnetppPOST(url_putEnterpriseScore, params, false, function(data, status) {
					SendBusinessOperationsLogNotifi('师傅端评分', '245', params, params, '', data, '师傅端评分接口', '245-01')
					hideProgress();
					if (status == 'success') {
						//1,成功，返回success
						if (data.code == 200) {
							ShowToast('提交成功');
							sendNotifi();
							backClick();
							//2,您本月已提交过日报,返回has
						} else {
							ShowToast(data.message);
						}
					} else {
						ShowToast('网络异常,请检查网络!');
					}
				});
			}
		}

		//数字限制
		function Digital_limit(num) {
			var reg = /^((?!0)\d{1,2}|100)$/;
			if (!num.match(reg)) {
				return false;
			} else {
				return true;
			}
		}
		//数字输入提示
		function onlyNum(obj) {
			if (obj.value > 100) {
			   ShowToast('分数最多只能输入100分');
				obj.value = 100;
			}
		}
       //发送通知
		function sendNotifi() {
			api.sendEvent({
				name : 'MasterGradeListNotifi'
			});
		}

		//重新评分
		function againGrade() {
			api.pageParam['scores_status'] = 2
			
			api.pageParam['isagain'] = true;
			api.openWin({useWKWebView:true,
				name : 'Practice_MasterGradeDetail',
				url : 'Practice_MasterGradeDetail.html',
				pageParam : api.pageParam,
				reload : true,
				allowEdit : true
			});
		}
	</script>
</html>